package com.zhuang.chapter18;

public class RectMain {

	public static void main(String[] args) {
		Rect rect1 = new Rect(10, 20);
		Rect rect2 = new Rect();
		rect2.setWidth(20);
		rect2.setLength(30);
		rect1.countArea();
		rect2.countArea();
	}

}

class Rect {
	private int length;
	private int width;

	public Rect(int length, int width) {
		super();
		this.length = length;
		this.width = width;
	}

	public Rect() {
		super();
	}

	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		this.length = length;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public void countCircumference() {
		System.out.println("矩形周长为-->" + (length + width) * 2);
	}

	public void countArea() {
		System.out.println("矩形面积为-->" + length * width);
	}

}
